﻿using parkMonitor.model;
using parkMonitor.view;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace parkMonitor.viewModel.detail
{
    /// <summary></summary>
    public class DevDetailItemVM : INotifyPropertyChanged, ISelectProperty
    {
        public DevDetailItemVM()
        {

        }

        //address
        int _Address = -1;
        public int Address
        {
            get { return _Address; }
            set { _Address = value; FirePropertyChanged("Address"); }
        }

        //Real Value
        string _RealValue = "";
        public string RealValue
        {
            get { return _RealValue; }
            set { _RealValue = value; FirePropertyChanged("RealValue"); }
        }

        //name
        string _Name = "";
        public string Name
        {
            get { return _Name; }
            set { _Name = value; FirePropertyChanged("Name"); }
        }

        //Short Name
        string _ShortName = "";
        public string ShortName
        {
            get { return _ShortName; }
            set { _ShortName = value; FirePropertyChanged("ShortName"); }
        }

        //info
        string _Data = "";
        public string Data
        {
            get { return _Data; }
            set { _Data = value; FirePropertyChanged("Data"); }
        }

        //是否可写
        bool _CanWrite = false;
        public bool CanWrite
        {
            get { return _CanWrite; }
            set { _CanWrite = value; FirePropertyChanged("CanWrite"); }
        }

        //是否可复位
        bool _CanReset = false;
        public bool CanReset
        {
            get { return _CanReset; }
            set { _CanReset = value; FirePropertyChanged("CanReset"); }
        }

        //short info
        string _ShortData = "";
        public string ShortData
        {
            get { return _ShortData; }
            set { _ShortData = value; FirePropertyChanged("ShortData"); }
        }

        //Left Width
        Double _LeftWidth = Double.NaN;
        public Double LeftWidth
        {
            get { return _LeftWidth; }
            set { _LeftWidth = value; FirePropertyChanged("LeftWidth"); }
        }

        //status
        ComInfoStatus _DevStatus = ComInfoStatus.Normal;
        public ComInfoStatus DevStatus
        {
            get { return _DevStatus; }
            set { _DevStatus = value; FirePropertyChanged("DevStatus"); }
        }

        //Alarm Status
        AlarmStatus _AlarmStatus = AlarmStatus.None;
        public AlarmStatus AlarmStatus
        {
            get { return _AlarmStatus; }
            set { _AlarmStatus = value; FirePropertyChanged("AlarmStatus"); }
        }

        //是否选中
        bool _IsSelected = false;
        public bool IsSelected
        {
            get { return _IsSelected; }
            set { _IsSelected = value; FirePropertyChanged("IsSelected"); }
        }

        public virtual event PropertyChangedEventHandler PropertyChanged;
        public virtual void FirePropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
